package com.example.valuation.activity;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;

import androidx.fragment.app.Fragment;

import com.example.valuation.R;
import com.example.valuation.adapterr.ReportFragmentAdapter;
import com.example.valuation.fragment.Tab1Fragment;
import com.example.valuation.fragment.Tab2Fragment;
import com.example.valuation.view.CannotScrollViewPager;
import com.flyco.tablayout.SlidingTabLayout;

import butterknife.BindView;

public class MainActivity extends BaseActivity {
    @BindView(R.id.view)
    View view;
    @BindView(R.id.tabs)
    SlidingTabLayout tabLayout;
    String[] nameList = new String[]{"KG", "LBS"};
    @BindView(R.id.vp_pager)
    CannotScrollViewPager viewPager;
    private Fragment[] fragments;
    private ReportFragmentAdapter adapter;

    @SuppressLint("CheckResult")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.activity_main);
        super.onCreate(savedInstanceState);
        initImmersionBar(view);
        fragments = new Fragment[2];
        fragments[0] = new Tab1Fragment();
        fragments[1] = new Tab2Fragment();

        adapter = new ReportFragmentAdapter(getSupportFragmentManager(), fragments, nameList);
        viewPager.setAdapter(adapter);
        viewPager.setOffscreenPageLimit(2);
        tabLayout.setViewPager(viewPager, nameList);


    }
}